package com.zksb.service.impl;

import com.zksb.dao.UserDao;
import com.zksb.entity.User;
import com.zksb.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    public UserServiceImpl() {
        System.out.println("UserServiceImpl.....");
    }

    @Override
    public int add(User user) {
        int row = userDao.add(user);
        int i=10/0;
        return row;
    }

    @Override
    public int batchAdd(List<User> userList) {
        int row = userDao.batchAdd(userList);
//        int i = 10/0;
        return row;
    }

    @Override
    public User get(int id) {
        return userDao.get(id);
    }

    @Override
    public List<User> getUserByDepartId(int departId) {
        return userDao.getUserByDepartId(departId);
    }

    @Override
    public List<User> findAll(User user) {
        return userDao.findAll(user);
    }
}
